<?php


namespace app\api\model;

use think\Model;
class DongTai extends Model
{
    protected $name = 'dongtai';
    //当取出来时ctime就是按照这个格式转换的
    protected $type = [ 'create_time' => 'timestamp:Y-m-d H:i', ];
    // 开启自动写入时间戳 
    protected $autoWriteTimestamp = true; 
    // 定义自动完成的属性
    protected $insert = [
    	'dnumber' => 0,
    	'pnumber' => 0,
    	'snumber' => 0,
    	]; 
    //定义关联方法
    public function user() 
    { 
    	return $this->belongsTo('User');
    }
    
    //
    public function dianzans()
    {
    	return $this->hasMany('Dianzan');
    }
    public function pinluns()
    {
    	return $this->hasMany('Pinlun');
    }
}